import React from "react";
import { Button, Space } from "antd";
import { DICT_TYPE, } from "@/utils/dict";
import dictTag from "@/component/Dict-Tag/Dict-Tag";
import CommodityCard from "@/ui/xx-commodityCard/commodityCard";

/**@description 列表表格字段 */
const getColumns = ({ gotoDetail = Function }) => {
    const columns = [
        {
            title: "订单号|订单类型",
            key: "productId",
            dataIndex: "productId",
            width: 160,
        },
        {
            title: "商品信息",
            key: "product",
            dataIndex: "product",
            width: 380,
            render: (text, record) => <CommodityCard data={record} />
        },
        {
            title: "买家信息",
            key: "buyer",
            dataIndex: "buyer",
            width: 180
        },
        {
            title: "支付状态",
            key: "payStatus",
            dataIndex: "payStatus",
            width: 180
        },
        {
            title: "支付方式",
            key: "payMethodName",
            dataIndex: "payMethodName",
            width: 180,
            // getIntDictOptions
            render: (text, record) => dictTag(DICT_TYPE.PAY_METHODS, text)
        },
        {
            title: "支付时间",
            key: "payDateTime",
            dataIndex: "payDateTime",
            width: 180
        },
        {
            title: "订单状态",
            key: "orderStatus",
            dataIndex: "orderStatus",
            width: 180
        },
        {
            title: "操作",
            key: "action",
            width: 250,
            dataIndex: "action",
            render: (text, record) => (<>
                <Space>
                    <Button type="link" onClick={() => gotoDetail(1)}>详情</Button>
                    {/* <Button type="link" onClick={() => openOrderDetailModal({ type: "update", record })}>详情</Button> */}
                </Space>
            </>)
        },
    ];
    return columns;
}

export default getColumns;